package com.example.smart.ui.activity.home

import com.example.lib.utils.statusbar.StatusBarUtils
import com.example.smart.R
import com.example.smart.base.ui.activity.BaseActivity
import com.example.smart.databinding.ActivityDayTaskBinding
import com.example.smart.room.factory.RoomFactory
import com.necer.painter.InnerPainter

class DayTaskActivity : BaseActivity<ActivityDayTaskBinding>() {
    private var nowNowChooseDate = ""
    private val mReservationRepository = RoomFactory.createReservationRepository()

    override fun layoutID() = R.layout.activity_day_task

    override fun initView() {
        StatusBarUtils.setStateAndNavigationBar(this@DayTaskActivity,
            statusBarColor = com.example.lib.R.color.translate)

        mReservationRepository.getAllData {
            val painter = binding.CalenderView.calendarPainter as InnerPainter
            painter.addPointList(it.map { map -> map.date })
        }
    }

    override fun initListener() {
        binding.CalenderView.setOnCalendarChangedListener { p0, p1, p2, p3, p4 ->
            nowNowChooseDate = p3.toString()
            binding.Time.text = "$p1-$p2"
        }
    }
}